const express = require('express')
const router = express.Router()
const auth = require('@/middleware/auth.middleware')
const statisticController = require('@/controllers/statistic.controller')

/**
 * 文章、友圈、用户、标签数量查询
 * @route GET /statistic/count-all
 * @summary 文章、友圈、用户、标签数量查询
 * @group 首页统计
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.get('/count-all', auth(), statisticController.statisticCountall)

/**
 * 近6个月文章和友圈发布数量趋势
 * @route GET /statistic/public-trend
 * @summary 近6个月文章和友圈发布数量趋势
 * @group 首页统计
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.get('/public-trend', auth(), statisticController.publicContentTrend)

/**
 * 近30天站点接口访问量统计
 * @route GET /statistic/visit-counts
 * @summary 近15天站点接口访问量统计
 * @group 首页统计
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.get('/visit-counts', auth(), statisticController.statisticVisitCounts)

/**
 * 站点标签库前30个标签查询
 * @route GET /statistic/hot-tags
 * @summary 站点标签库前30个标签查询
 * @group 首页统计
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.get('/hot-tags', auth(), statisticController.findHotTags)

/**
 * 热度浏览量前10的文章统计
 * @route GET /statistic/hot-articles
 * @summary 热度浏览量前10的文章统计
 * @group 首页统计
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.get('/hot-articles', auth(), statisticController.fingHotArticle)

/**
 * 站点各个地区访问量查询
 * @route GET /statistic/city-visit-count
 * @summary 站点各个地区访问量查询
 * @group 首页统计
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.get('/city-visit-count', auth(), statisticController.visitCountFronCity)

module.exports = router
